//
//  CWTabWidget.h
//  CWDevelop
//
//  Created by LittoCats on 7/16/14.
//  Copyright (c) 2014 Littocats. All rights reserved.
//

//item's attributes example
//{
//    "type": "DQMainViewTabBarItem",
//    "id": "DQMainView_Tab1",
//    "text": "问问",
//    "image": "main_tab_ask",
//    "imageSelected":"",
//    "textColor": "#FF6200",
//    "textColorSelected":"",
//    "backgroundColor":"",
//    "backgroundColorSelected":"",
//    "tabContent": {
//        "type": "page",
//        "name": "Ask",
//        "params": {
//            "hideNavBar": true
//        }
//    }
//}

#import <UIKit/UIKit.h>


@class CWTabBar;
@class CWTabBarItem;
@interface CWTabWidget : UIView

@property (nonatomic, strong) UINavigationController *contentNavigator;

@property (nonatomic, strong) CWTabBar *tabBar;

@property (nonatomic, strong) NSMutableDictionary *contents;

@end

@protocol CWTabBarDelegate <NSObject>

- (void)tabBar:(CWTabBar *)tabBar didSelectItem:(CWTabBarItem *)item atIndex:(NSInteger)index;

@end

@interface CWTabBar : UIScrollView

@property (nonatomic, strong) NSArray *items;

@property (nonatomic, weak) CWTabBarItem *currentItem;

@property (nonatomic, weak) id<CWTabBarDelegate, UIScrollViewDelegate> delegate;

- (instancetype)initWithItems:(NSArray *)items;

- (void)selectItemAtIndex:(NSInteger)index;

@end
@interface CWTabBarItem : UIControl

- (void)setSelected:(BOOL)selected;

@property (nonatomic, readonly) NSString *title;

@property (nonatomic, readonly) UIImage *image;

@property (nonatomic, readonly) UIImage *imageSelected;

@property (nonatomic, readonly) UIColor *titleColor;

@property (nonatomic, readonly) UIColor *titleColorSelected;

@property (nonatomic, readonly) UIColor *backgroundColorSelected;

@end